import router from '@/router'
import { useUserStore } from '@/stores/user'


router.beforeEach((to, from, next) => {
    console.log(123456)
    const userStore = useUserStore()
    const userInfo = userStore.getUser
    console.log(78, userInfo)
    if (to.meta.requiresAuth) {
        if (userInfo) {
            next()
        } else {
            next({ name: 'login' })
        }
    } else {
        next()
    }
})

export default router
